package Map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;

public class HashMap_01 {


    public static void main(String[] args) {
        Map<String,Integer> maps =new HashMap<>();
        maps.put("iphone14",100);
        maps.put("iphone13",100);
        maps.put("iphone12",100);
        maps.put("iphone11",100);
        System.out.println(maps);
        Set<String> set = maps.keySet();
        for (String s : set)
        {
            int values=maps.get(s);
            System.out.println(s +"====>" +values);
        }
        System.out.println("===============================");

        Set<Map.Entry<String, Integer>> entrySet = maps.entrySet();
        for (Map.Entry<String, Integer> entry : entrySet)
        {
            String key = entry.getKey();
            Integer value = entry.getValue();
            System.out.println(key+"---------->"+value);
        }

        System.out.println("------------------------------");
        maps.forEach(new BiConsumer<String, Integer>() {
            @Override
            public void accept(String key, Integer value) {
                System.out.println(key+"===========>"+value);
            }
        });
        System.out.println("------------------------------");
        maps.forEach((key, value) ->{ System.out.println(key+"===========>"+value); });
    }
}
